package com.bw.controller;

import com.bw.entity.Bing;
import com.bw.entity.Zxt;
import com.bw.mapper.EchartsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class EchartsController {

    @Autowired
    EchartsMapper echartsMapper;

    /**
     * 报表的页面
     * @return
     */
    @RequestMapping("tuPage.do")
    public String tu(){

        return "tu";
    }

    /**
     * 获取折线图/柱状图需要数据
     * @return
     */
    @RequestMapping("zxt.do")
    @ResponseBody // 把返回值 序列化为Json格式
    public List<Zxt> zxt(){

       List<Zxt> zxtList = echartsMapper.selectStudent();
        return zxtList;
    }

    /**
     * 获取饼图需要的数据
     * @return
     */
    @RequestMapping("bing.do")
    @ResponseBody // 把返回值 序列化为Json格式
    public List<Bing> bing(){

        List<Bing> bingList = echartsMapper.selectStudentBing();
        return bingList;

    }


}
